<template>
  <div
    class="flowContainer"
    :style="{
      paddingBottom: tempData.paddingBottom + 'px',
      paddingLeft: tempData.paddingTwice + 'px',
      paddingRight: tempData.paddingTwice + 'px',
      paddingTop: tempData.paddingTop + 'px',
      boxSizing: 'border-box',
    }"
  >
    <div class="flowContent" v-if="tempData.styleType == 1 || !tempData.styleType">
      <div
        class="modalBg"
        v-show="tempData.loadType == 0"
        :style="{
          borderTopLeftRadius: tempData.radiusNumTop + 'px',
          borderTopRightRadius: tempData.radiusNumTop + 'px',
          borderBottomLeftRadius: tempData.radiusNumBottom + 'px',
          borderBottomRightRadius: tempData.radiusNumBottom + 'px',
        }"
      >
        <div class="loadBtn"> 当前流量非实时流量，请点击此处刷新流量 </div>
      </div>
      <div
        class="Totals"
        :style="{
          borderTopLeftRadius: tempData.radiusNumTop + 'px',
          borderTopRightRadius: tempData.radiusNumTop + 'px',
          borderBottomLeftRadius: tempData.radiusNumBottom + 'px',
          borderBottomRightRadius: tempData.radiusNumBottom + 'px',
        }"
      >
        <div class="tops">
          <div class="left">
            <img src="@/assets/didaima/shuju1.png" alt="" />
            总流量
          </div>
          <div class="right"> 刷新流量 </div>
        </div>
        <div v-if="tempData.loadType == 0" class="lines">---</div>
        <a-spin v-else style="margin-left: 16px" />
        <div class="nows">当前流量刚刚刷新</div>
        <div class="clicks">查看使用套餐详情></div>
      </div>
      <div class="rights">
        <div
          class="useAmt"
          :style="{
            borderTopLeftRadius: tempData.radiusNumTop + 'px',
            borderTopRightRadius: tempData.radiusNumTop + 'px',
            borderBottomLeftRadius: tempData.radiusNumBottom + 'px',
            borderBottomRightRadius: tempData.radiusNumBottom + 'px',
          }"
        >
          <div class="boxs">
            <div class="tops">
              <div class="left">
                <img src="@/assets/didaima/shuju2.png" alt="" />
                已用流量
              </div>
              <div class="right"> </div>
            </div>
            <div v-if="tempData.loadType == 0" class="lines">---</div>
            <a-spin v-else style="margin-left: 16px" />
          </div>
          <p class="righticon">
            <icon-right />
          </p>
        </div>
        <div
          class="loseAmt"
          :style="{
            borderTopLeftRadius: tempData.radiusNumTop + 'px',
            borderTopRightRadius: tempData.radiusNumTop + 'px',
            borderBottomLeftRadius: tempData.radiusNumBottom + 'px',
            borderBottomRightRadius: tempData.radiusNumBottom + 'px',
          }"
        >
          <div class="boxs">
            <div class="tops">
              <div class="left">
                <img src="@/assets/didaima/shuju2.png" alt="" />
                剩余流量
              </div>
              <div class="right"> </div>
            </div>
            <div v-if="tempData.loadType == 0" class="lines">---</div>
            <a-spin style="margin-left: 16px" v-else />
          </div>
          <p class="righticon">
            <icon-right />
          </p>
        </div>
      </div>
    </div>
    <div
      class="flowContentw"
      v-if="tempData.styleType == 2"
      :style="
        tempData.showType == 1
          ? {
              borderTopLeftRadius: tempData.radiusNumTop + 'px',
              borderTopRightRadius: tempData.radiusNumTop + 'px',
              borderBottomLeftRadius: tempData.radiusNumBottom + 'px',
              borderBottomRightRadius: tempData.radiusNumBottom + 'px',
              backgroundColor: tempData.boxBg,
            }
          : {
              borderTopLeftRadius: tempData.radiusNumTop + 'px',
              borderTopRightRadius: tempData.radiusNumTop + 'px',
              borderBottomLeftRadius: tempData.radiusNumBottom + 'px',
              borderBottomRightRadius: tempData.radiusNumBottom + 'px',
              backgroundImage: 'url(' + tempData.bgImage + ')',
              backgroundSize: '100% 100%',
            }
      "
    >
      <div class="boxItem1">
        <p class="nums">100G</p>
        <p class="texts"> 总流量 </p>
      </div>
      <div class="lines1"></div>
      <div class="boxItem1">
        <p class="nums">100G</p>
        <p class="texts"> 总流量 </p>
      </div>
      <div class="lines1"></div>
      <div class="boxItem1">
        <p class="nums">100G</p>
        <p class="texts"> 总流量 </p>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
  import { ref, watch } from 'vue'

  const props = defineProps({
    // 选中的当前组件参数
    compObj: {
      type: Object,
      default: () => {
        return {}
      },
    },
  })
  console.log(props)
  const tempData: any = ref({})
  watch(
    () => props.compObj,
    (newVal, oldVal) => {
      tempData.value = JSON.parse(JSON.stringify(newVal))
    },
    { immediate: true, deep: true }
  )
</script>

<style scoped lang="less">
  :deep(.arco-spin-icon) {
    color: #fff;
  }
  .flowContainer {
    width: 100%;
    .flowContentw {
      width: 100%;
      display: flex;
      padding: 15px 0px;
      box-sizing: border-box;
      justify-content: space-between;
      align-items: center;
      .lines1 {
        width: 1px;
        height: 25px;
        background-color: #f5f5f5;
      }
      .boxItem1 {
        width: calc((100% - 2px) / 3);
        .nums {
          font-size: 16px;
          line-height: 16px;
          color: #1d2129;
          width: 100%;
          margin-bottom: 5px;
          text-align: center;
        }
        .texts {
          font-size: 11px;
          color: #1d2129;
          width: 100%;
          text-align: center;
        }
      }
    }
    .flowContent {
      width: 100%;
      display: flex;
      justify-content: space-between;
      align-items: center;
      position: relative;
      .modalBg {
        width: 100%;
        height: 100%;
        background-color: #00000051;
        display: flex;
        justify-content: center;
        align-items: center;
        position: absolute;
        top: 0px;
        bottom: 0px;
        left: 0px;
        right: 0px;
        .loadBtn {
          background-color: #3c9cff;
          padding: 10px 20px;
          text-align: center;
          font-size: 12px;
          color: #fff;
          border-radius: 5px;
        }
      }
      .Totals {
        width: 48%;
        height: 134px;
        background: linear-gradient(145deg, #3c9cff, #9acafc);
        margin-right: 10px;
        padding: 12px;
        box-sizing: border-box;
        .tops {
          width: 100%;
          display: flex;
          justify-content: space-between;
          align-items: center;
          .left {
            font-size: 14px;
            color: #fff;
            display: flex;
            align-items: center;
            img {
              width: 14px;
              height: 14px;
              margin-right: 4px;
            }
          }
          .right {
            font-size: 8px;
            color: #fff;
          }
        }
        .lines {
          width: 100%;
          font-size: 20px;
          color: #fff;
          margin-top: 14px;
          line-height: 20px;
          padding-left: 15px;
        }
        .nows {
          font-size: 8px;
          color: #fff;
          padding-left: 15px;
        }
        .clicks {
          font-size: 8px;
          color: #fff;
          margin-top: 16px;
          padding-left: 15px;
        }
      }
      .rights {
        flex-grow: 1;
        display: flex;
        align-content: space-between;
        flex-wrap: wrap;
        .useAmt {
          width: 100%;
          height: 62px;
          background: linear-gradient(145deg, #5ac275, #a9e08f);
          margin-bottom: 10px;
          padding: 12px;
          box-sizing: border-box;
          display: flex;
          justify-content: space-between;
          align-items: center;
          .righticon {
            font-size: 20px;
            color: #fff;
          }
          .boxs {
            .tops {
              width: 100%;
              display: flex;
              justify-content: space-between;
              align-items: center;
              .left {
                font-size: 14px;
                color: #fff;
                display: flex;
                align-items: center;
                img {
                  width: 14px;
                  height: 14px;
                  margin-right: 4px;
                }
              }
              .right {
                font-size: 8px;
                color: #fff;
              }
            }
            .lines {
              width: 100%;
              font-size: 20px;
              color: #fff;
              margin-top: 8px;
              line-height: 10px;
              margin-left: 15px;
            }
          }
        }
        .loseAmt {
          width: 100%;
          height: 62px;
          background: linear-gradient(145deg, #f9ae3d, #f9d39d);
          padding: 12px;
          box-sizing: border-box;
          display: flex;
          justify-content: space-between;
          align-items: center;
          .righticon {
            font-size: 20px;
            color: #fff;
          }
          .boxs {
            .tops {
              width: 100%;
              display: flex;
              justify-content: space-between;
              align-items: center;
              .left {
                font-size: 14px;
                color: #fff;
                display: flex;
                align-items: center;
                img {
                  width: 14px;
                  height: 14px;
                  margin-right: 4px;
                }
              }
              .right {
                font-size: 8px;
                color: #fff;
              }
            }
            .lines {
              width: 100%;
              font-size: 20px;
              color: #fff;
              margin-top: 8px;
              line-height: 10px;
              margin-left: 15px;
            }
          }
        }
      }
    }
  }
</style>
